﻿@using DMS.BO.Web.Mvc
@using DMS.BO.Web.Ajax
@model DMS.Entities.Hotel


    @using (Ajax.BeginForm("Update", "Hotel", FormMethod.Post, new BOAjaxOptions {OnSuccess="UpdateHotel_OnSuccess" }, new { @id = "frm" }))
    { 
        <table class="ad_content" width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td class="col_odd">
                    <fieldset style="width: 260px; float: left;">
                        <span class="form_title" for="name">Tên khách sạn <span style="color: red">(*)</span></span>
                        <div class="row">
                             @Html.TextBoxFor(m => m.Name, new { @style = "width: 250px;",@id="name",@data_val="true",@data_val_required=""})
                            
                        </div>
                        <span class="form_title">Trạng thái <span style="color: red">(*)</span></span>
                        <div class="row" style="text-align: left">
                            @Html.EnumDropDownList("Status", null, typeof(DMS.Entities.HotelStatus), false, "", new { @id="status"}, "")
                            @Html.HiddenFor(m => m.ID, new {@id="hotelID" })
                        </div>
                        <!-- Allow form submission with keyboard without duplicating the dialog button -->
                       
                    </fieldset>
                    <div style="margin-top:175px;">
                     <input type="submit" value="Lưu" class="btn_sumit" style="width: 50px;" />
                     <input value="Thoát" id="btnExit" class="btn_sumit" style="width: 50px;padding:0;text-align:center;" />
                        </div>
                </td>
            </tr>
        </table>
    }


<script>   

    $(function () {
        $.validator.unobtrusive.parse($('#frm'));
    });

    $("#btnExit").click(function () {
        dialog.dialog('close');
    });

    function UpdateHotel_OnSuccess(returnData) {
        if (returnData) {
            $("#frmHotel").submit();
            dialog.dialog("close");
        }
        else {
            alert('Cập nhật không thành công');
        }
    }
</script>